package com.zbkj.front.service;

import com.github.pagehelper.PageInfo;
import com.zbkj.common.model.order.Order;
import com.zbkj.common.model.order.OrderDetail;
import com.zbkj.common.model.saleroom.SaleRoom;
import com.zbkj.common.model.user.UserAddress;
import com.zbkj.common.request.*;
import com.zbkj.common.response.*;
import com.zbkj.common.vo.LogisticsResultVo;
import com.zbkj.common.vo.MyRecord;
import com.zbkj.common.vo.PreOrderInfoVo;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 * 移动端端订单操作
 * +----------------------------------------------------------------------
 * | CRMEB [ CRMEB赋能开发者，助力企业发展 ]
 * +----------------------------------------------------------------------
 * | Copyright (c) 2016~2025 https://www.crmeb.com All rights reserved.
 * +----------------------------------------------------------------------
 * | Licensed CRMEB并不是自由软件，未经许可不能去掉CRMEB相关版权
 * +----------------------------------------------------------------------
 * | Author: CRMEB Team <admin@crmeb.com>
 * +----------------------------------------------------------------------
 */
public interface FrontOrderService {

    /**
     * 预下单V1.7
     *
     * @param request 预下单请求参数
     * @return PreOrderResponse
     */
    OrderNoResponse preOrder_V1_7(PreOrderRequest request);


    /**
     * 加载预下单信息
     *
     * @param preOrderNo 预下单号
     * @return 预下单信息
     */
    PreOrderResponse loadPreOrder(String preOrderNo);

    /**
     * 计算订单价格
     *
     * @param request 计算订单价格请求对象
     * @return ComputedOrderPriceResponse
     */
    ComputedOrderPriceResponse computedOrderPrice(OrderComputedPriceRequest request);

    /**
     * 创建订单
     *
     * @param orderRequest 创建订单请求参数
     * @return OrderNoResponse 订单编号
     */
    OrderNoResponse createOrder(CreateOrderRequest orderRequest);

    /**
     * 移动端订单详情
     *
     * @param orderNo 订单编号
     * @return OrderFrontDetailResponse
     */
    OrderFrontDetailResponse frontDetail(String orderNo);

    /**
     * 订单商品评论列表
     *
     * @param pageRequest 分页参数
     * @return PageInfo
     */
    PageInfo<InfoReplyResponse> replyList(PageParamRequest pageRequest);

    /**
     * 评价订单商品
     *
     * @param request 评价参数
     */
    Boolean replyProduct(OrderProductReplyRequest request);

    /**
     * 取消订单
     *
     * @param orderNo 订单编号
     */
    Boolean cancel(String orderNo);

    /**
     * 订单收货
     *
     * @param orderNo 订单号
     * @return Boolean
     */
    Boolean takeDelivery(String orderNo);

    /**
     * 删除订单
     *
     * @param orderNo 订单号
     * @return Boolean
     */
    Boolean delete(String orderNo);

    /**
     * 售后申请列表(可申请售后列表)
     *
     * @param request 搜索参数
     */
    PageInfo<OrderDetail> getAfterSaleApplyList(CommonSearchRequest request);

    /**
     * 查询退款理由
     *
     * @return 退款理由集合
     */
    List<String> getRefundReason();

    /**
     * 订单退款申请
     *
     * @param request 申请参数
     * @return Boolean
     */
    Boolean refundApply(OrderRefundApplyRequest request);

    /**
     * 退款订单列表
     *
     * @param request 搜索参数
     * @return PageInfo
     */
    PageInfo<RefundOrderResponse> getRefundOrderList(OrderAfterSalesSearchRequest request);

    /**
     * 退款订单详情
     *
     * @param refundOrderNo 退款订单号
     * @return RefundOrderInfoResponse
     */
    RefundOrderInfoResponse refundOrderDetail(String refundOrderNo);

    /**
     * 订单物流详情
     */
    LogisticsResultVo getLogisticsInfo(Integer invoiceId);

    /**
     * 获取发货单列表
     *
     * @param orderNo 订单号
     * @return 发货单列表
     */
    OrderInvoiceFrontResponse getInvoiceList(String orderNo);

    /**
     * 获取个人中心订单数量
     */
    OrderCenterNumResponse userCenterNum();

    /**
     * 获取订单状态图
     */
    List<HashMap<String, Object>> getOrderStatusImage();

    /**
     * 计算订单运费
     */
    void getFreightFee_V_1_8(PreOrderInfoVo orderInfoVo, UserAddress userAddress, Boolean userIsPaidMember);


    /**
     * 退款单退回商品
     */
    Boolean returningGoods(OrderRefundReturningGoodsRequest request);

    /**
     * 撤销退款单
     *
     * @param refundOrderNo 退款单号
     */
    Boolean revoke(String refundOrderNo);

    /**
     * 订单列表(v1.4.0)
     *
     * @param request 搜索参数
     * @return PageInfo
     */
    PageInfo<OrderFrontDataResponse> list_v1_4(OrderFrontListRequest request);


    /**
     * 到店自提下单页面到店自提时获取门店接口
     *
     * @param position    用户定位
     * @param shopSpecIds 商品规格id
     * @return
     */
    List<SaleRoom> getSalerooms(String position, String shopSpecIds, String city);

    /**
     * 同城配送判断门店是否位置超过30KM/门店缺货,返回最近的一个门店id
     *
     * @param productAttrRequest 根据商品规格id和购买数量查询30km内门店是否有货
     * @return
     */
    Map<String, Object> getRecentlyRoom(ProductAttrRequest productAttrRequest);

    /**
     * 到店自提下单页面到店自提时获取门店接口
     *
     * @param productAttrRequest
     * @return
     */
    List<SaleRoom> getSaleroomsList(ProductAttrRequest productAttrRequest);

    /**
     * 根据订单号模糊查询订单
     *
     * @param orderNo
     * @return
     */
    List<Order> getOrder(String orderNo);

    /**
     * 确认订单(确认收货、确认签收等等)
     *
     * @param orderNo
     * @return
     */
    Boolean confirm(String orderNo);

    /**
     * 根据订单号查询配送员的经纬度
     *
     * @param orderGetLocationRequest
     * @return
     */
    Map getLocation(OrderGetLocationRequest orderGetLocationRequest);

    /**
     * 订单取消-带原因
     *
     * @param orderCancelRequest
     * @return
     */
    Boolean orderCancel(OrderCancelRequest orderCancelRequest);

    /**
     * 配送员退款订单列表
     *
     * @param refundOrderDeliveryPersonnelRequest
     * @return
     */
    PageInfo<RefundOrderResponse> getRefundOrderListByDeliveryPersonnel(RefundOrderDeliveryPersonnelRequest refundOrderDeliveryPersonnelRequest);

    /**
     * 拒绝退款单-只能配送员拒绝
     *
     * @param refuseRefundRequest
     * @return
     */
    Boolean refuseRefund(RefuseRefundRequest refuseRefundRequest);

    /**
     * 根据订单编号查询门店营业时间以及用户当前的配送券数量
     *
     * @param orderNo
     * @return
     */
    Map getBusinessHours(String orderNo);

    /**
     * 根据订单号查询配送员的经纬度
     *
     * @param orderGetLocationRequest
     * @return
     */
    Map getLocationV2(OrderGetLocationRequest orderGetLocationRequest);
}
